from sentence_transformers import SentenceTransformer
import os

# 创建模型目录
model_dir = "./my_models/all-MiniLM-L6-v2"
os.makedirs(model_dir, exist_ok=True)

# 下载模型到指定目录
print("正在下载模型...")
model = SentenceTransformer(
    'sentence-transformers/all-MiniLM-L6-v2',
    cache_folder=model_dir
)
print(f"模型已下载到: {model_dir}")